--斡赴正场 衍生
local wofuzhengchang_other = fk.CreateSkill{
name = "mcdh_wofuzhengchang_other&",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

wofuzhengchang_other:addEffect('active',{
    can_use = function(self, player)
        return table.find(Fk:currentRoom().alive_players, function(p) return p:hasSkill("mcdh_wofuzhengchang") and p ~= player end)
    end,
    card_num = 3,
    can_min_num = 3,
    card_filter = function(self,player, to_select, selected)
        return #selected < 3 and not player:prohibitDiscard(Fk:getCardById(to_select))
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local targets = table.filter(room:getOtherPlayers(player), function(p) return p:hasSkill("mcdh_wofuzhengchang")  end)
        if #targets == 0 then return false end
        local to
        if #targets == 1 then
            to = targets[1]
        else
            to = room:askToChoosePlayers(player,{targets=targets,min_num=1,max_num=1,skill_name=self.name,cancelable=false})[1]
        end
        room:throwCard(effect.cards, self.name, player, player)
        local  cards = room:askForDiscard(to, 1, 1, false, "mcdh_wofuzhengchang", true, "jink", "#wofuzhengchang-discard")
        if not (#cards > 0) then
            room:damage({
                from = player,
                to = to,
                damage = 1,
                skillName = "mcdh_wofuzhengchang",
            })
        end
        room:handleAddLoseSkills(to, "-mcdh_wofuzhengchang", nil, false, false)
    end
})

Fk:loadTranslationTable{
    ["mcdh_wofuzhengchang_other&"] = "斡赴正场",
    [":mcdh_wofuzhengchang_other&"] = "出牌阶段，你可以弃置三张牌，令杰克逊选择一项并令失去斡赴正场：1.弃置一张【闪】；2.受到其造成的1点伤害。",
    ["wofuzhengchang-discard"] = "斡赴正场:弃置一张【闪】",
}

return wofuzhengchang_other